
/* _____________________________________________________________________________

* 	Paper: Perspective-Taking Through Partisan Eyes
* 	Replication File - Read Me
* 	Date: 2022
* 	Authors: Donald Casler and Dylan Groves, dylanwgroves@gmail.com
________________________________________________________________________________*/


/* Introduction ________________________________________________________________*/

	clear all
	set more off

/* Set Global ___________________________________________________________________*/

	gl stata "X:\Dropbox\Paper - PTinIR\09 Code\07_Replication\"

/* Import Data _________________________________________________________________*/

	use "${stata}\ptinir_data_wave3_raw.dta", clear

/* Attention Checks ____________________________________________________________*/

	destring q_recaptchascore, replace
	gen check1_captcha = (q_recaptchascore > 0.7)
		drop q_recaptchascore
		
	*rename prolif_id svy_uid_prolifi
	gen check2_swim = 1 if scenario_check == "Disagree" | scenario_check == "Strongly disagree"
		replace check2_swim = 0 if scenario_check == "Agree" | scenario_check == "Strongly agree"
		drop scenario_check
		
/* Pre-Treatment Covariates ____________________________________________________*/

	drop status 
	drop progress 
	drop finished
	drop distributionchannel
	drop q85
	drop q85_do
	drop recordeddate

	* Consent
	encode consent, gen(consent2)
	drop consent
	gen consent = consent2
	lab def consent 0 "No Consent" 1 "Consent"
	lab val consent consent
	drop consent2
	lab var consent "Consent"
	
	* Gender 
	encode gender, gen(c_gender)
	lab var c_gender "Gender"
	
	* Ideology
	encode ideo7, gen(sb_ideology)
		recode sb_ideology 	(6 = 1 "Very conservative") ///
							(1 = 2 "Moderately conservative") ///
							(4 = 3 "Somewhat conservative") ///
							(3 = 4 "Neither liberal nor conservative") ///
							(5 = 5 "Somewhat liberal") ///
							(2 = 6 "Moderately liberal") ///
							(7 = 7 "Very liberal"), ///
							gen(c_ideology)
		drop ideo7 
		
		destring c_ideology, replace


		/*
		lab def c_ideology 	1 "Very conservative" 2 "moderately conservative" ///
							3 "somewhat conservative" 4 "neither liberal nor conservative" ///
							5 "somewhat liberal" 6 "moderately liberal" 7 "very liberal"
		*/		
		
	* Education (need to check this)
	encode edu, gen(sb_educ)
		recode sb_educ 	(1 = 0 "Less than a complete high school education") ///
						(4 = 1 "Complete high school education") ///
						(6 = 2 "Some college-level education, without degree") ///
						(2 3 = 3 "College-level education, with degree") ///
						(5 = 5 "Post-graduate education, with degree"), ///
						gen(c_education)
						
		drop edu
						
						
	* Empathy
	forval i = 1/5 {
		gen sb_pt_`i' = 0 if empathy_scale_`i' == "Not well at all"
		replace sb_pt_`i' = 1 if empathy_scale_`i' == "Somewhat well"
		replace sb_pt_`i' = 2 if empathy_scale_`i' == "Moderately well"
		replace sb_pt_`i' = 3 if empathy_scale_`i' == "Extremely well"

		lab def sb_pt_`i' 0 "Not well" 1 "Somewhat well" 2 "Moderate well" 3 "Extremely well"
		lab val sb_pt_`i' sb_pt_`i'
		drop empathy_scale_`i'
	}

	rename sb_pt_1 c_pt_allsides
		lab var c_pt_allsides "I try to look at everyones side of disagreement"

	rename sb_pt_2 c_pt_touched
		lab var c_pt_touched "I am often quite touched by things that I see happen"

	rename sb_pt_3 c_pt_tender
		lab var c_pt_tender "I often have tender, concern feelings for people less fortunate"

	rename sb_pt_4 c_pt_nopov
		lab var c_pt_nopov "I sometimes find it difficult to see things from other guy's point of view"

	rename sb_pt_5 c_pt_notsorry
		lab var c_pt_notsorry "Sometimes I dont feel very sorry for other people"
		
	gen c_ce_index = (c_pt_allsides + (3-c_pt_nopov))/2
	gen c_ee_index = (c_pt_touched + c_pt_tender + (3-c_pt_notsorry))/3
	gen c_pt_index = (c_pt_allsides + (3-c_pt_nopov) + c_pt_touched + c_pt_tender + (3-c_pt_notsorry))/5
	
	
	drop empathy_scale_do


	* Foreign Policy Ideology - Military
	lab def fpmil 1 "Strongly disagree" 2 "Somewhat disagree" 3 "Neither" 4 "Somewhat agree" 5 "Strongly agree"

	forval i = 1/4 {
		
		gen sb_fpmil_`i' = .
		replace sb_fpmil_`i' = 1 if mil_assert_`i' == "Strongly disagree"
		replace sb_fpmil_`i' = 2 if mil_assert_`i' == "Somewhat disagree"
		replace sb_fpmil_`i' = 3 if mil_assert_`i' == "Neither agree nor disagree"
		replace sb_fpmil_`i' = 4 if mil_assert_`i' == "Somewhat agree"
		replace sb_fpmil_`i' = 5 if mil_assert_`i' == "Strongly agree"
		
		gen sb_fpmil_`i'_extreme = .
		replace sb_fpmil_`i'_extreme = 3 if mil_assert_`i' == "Strongly disagree"
		replace sb_fpmil_`i'_extreme = 2 if mil_assert_`i' == "Somewhat disagree"
		replace sb_fpmil_`i'_extreme = 1 if mil_assert_`i' == "Neither agree nor disagree"
		replace sb_fpmil_`i'_extreme = 2 if mil_assert_`i' == "Somewhat agree"
		replace sb_fpmil_`i'_extreme = 3 if mil_assert_`i' == "Strongly agree"
		
		lab val sb_fpmil_`i' fpmil
		drop mil_assert_`i'
	}
	
	rename sb_fpmil_1 c_fpmil_milstrength
		lab var c_fpmil_milstrength "The best way to ensure world peace is through American military strength"
		
	rename sb_fpmil_2 c_fpmil_strikefirst 
		lab var c_fpmil_strikefirst "Rather than reacting to our enemies, it is better for us to strike first"
		
	rename sb_fpmil_3 c_fpmil_influence 
		lab var c_fpmil_influence "Generally, the more influence America has on other nations, the better off they are"
		
	rename sb_fpmil_4 c_fpmil_milbad 
		lab var c_fpmil_milbad "The use of military force only makes problems worse"
		
	gen c_fpmil_index = (c_fpmil_milstrength + c_fpmil_strikefirst + c_fpmil_influence + (6-c_fpmil_milbad))/4
	gen c_fpmil_index_med = (c_fpmil_index > 2.25)
	
	gen c_fpmil_extreme = c_fpmil_index - 3
		replace c_fpmil_extreme = abs(c_fpmil_extreme)
		
	
	* Foreign Policy Ideology - Coop
	lab def fpcoop 1 "Strongly disagree" 2 "Somewhat disagree" 3 "Neither" 4 "Somewhat agree" 5 "Strongly agree"

	forval i = 1/4 {
		
		gen sb_fpcoop_`i' = .
		replace sb_fpcoop_`i' = 1 if coop_int_`i' == "Strongly disagree"
		replace sb_fpcoop_`i' = 2 if coop_int_`i' == "Somewhat disagree"
		replace sb_fpcoop_`i' = 3 if coop_int_`i' == "Neither agree nor disagree"
		replace sb_fpcoop_`i' = 4 if coop_int_`i' == "Somewhat agree"
		replace sb_fpcoop_`i' = 5 if coop_int_`i' == "Strongly agree"
		
		gen sb_fpcoop_`i'_extreme = .
		replace sb_fpcoop_`i'_extreme = 3 if coop_int_`i' == "Strongly disagree"
		replace sb_fpcoop_`i'_extreme = 2 if coop_int_`i' == "Somewhat disagree"
		replace sb_fpcoop_`i'_extreme = 1 if coop_int_`i' == "Neither agree nor disagree"
		replace sb_fpcoop_`i'_extreme = 2 if coop_int_`i' == "Somewhat agree"
		replace sb_fpcoop_`i'_extreme = 3 if coop_int_`i' == "Strongly agree"
		
		lab val sb_fpcoop_`i' fpcoop
		drop coop_int_`i'
	}
	
	rename sb_fpcoop_1 c_fpcoop_un
		lab var c_fpcoop_un "America needs to cooperate more with the United Nations in settling international disputes"
		
	rename sb_fpcoop_2 c_fpcoop_multilateral
		lab var c_fpcoop_multilateral "It is essential for the United States to work with other nations to solve problems such as overpopulation, hunger, and pollution"
		
	rename sb_fpcoop_3 c_fpcoop_active
		lab var c_fpcoop_active "The U.S. needs to play an active role in solving conflicts around the world"
		
	rename sb_fpcoop_4 c_fpcoop_iso 
		lab var c_fpcoop_iso "The U.S. government should just try to take care of the wellbeing of Americans and not get involved with other nations"
		
	gen c_fpcoop_index = (c_fpcoop_un + c_fpcoop_multilateral + c_fpcoop_active + (6-c_fpcoop_iso))/4
	gen c_fpcoop_index_extreme = (c_fpcoop_un + c_fpcoop_multilateral + c_fpcoop_active + c_fpcoop_iso)/4

	gen c_fpcoop_index_med = (c_fpcoop_index > 3.5)
			
	gen c_fpcoop_extreme = c_fpcoop_index - 3
		replace c_fpcoop_extreme = abs(c_fpcoop_extreme)
		
	* Attentiveness
	gen c_attention = .
		replace c_attention = 0 if pol_attent == "Never"
		replace c_attention = 1 if pol_attent == "Some of the time"
		replace c_attention = 2 if pol_attent == "About half the time"
		replace c_attention = 3 if pol_attent == "Most of the time"
		replace c_attention = 4 if pol_attent == "Always"
		
		lab def c_attention 0 "Never" 1 "Sometimes" 2 "Half" 3 "Most" 4 "Always"
		lab val c_attention c_attention
		lab var c_attention "How often do you pay attention to what's going on in government and politics?"
		
	drop pol_attent
	
	* Political Party
	gen c_pid = .
		replace c_pid = 3 if party == "Democrat"
		replace c_pid = 2 if party == "Independent"
		replace c_pid = 1 if party == "Republican"
		replace c_pid = 2 if party == "Other"
		replace c_pid = 2 if party == ""

		lab def c_pid 3 "Democrat" 2 "Independent" 1 "Republican" .o "Other"
		lab val c_pid c_pid
		lab var c_pid "Party ID"
	drop party 
	
	
	gen c_pid_long = .
		replace c_pid_long = 1 if st_rep == "Strong Republican"
		replace c_pid_long = 2 if st_rep == "Republican"
		replace c_pid_long = 2 if st_rep == "Lean Republican"
		replace c_pid_long = 3 if c_pid == 2
		replace c_pid_long = 4 if st_dem == "Lean Democrat"
		replace c_pid_long = 4 if st_dem == "Democrat"
		replace c_pid_long = 5 if st_dem == "Strong Democrat"
		
		
	gen c_pid_strong = .
		replace c_pid_strong = 1 if c_pid == 2 
		replace c_pid_strong = 2 if st_rep == "Lean Republican"
		replace c_pid_strong = 2 if st_rep == "Lean Democrat"
		replace c_pid_strong = 2 if st_rep == "Democrat"
		replace c_pid_strong = 2 if st_rep == "Republican"
		replace c_pid_strong = 3 if st_dem == "Strong Republican"
		replace c_pid_strong = 3 if st_dem == "Strong Democrat"
		
		
/* Treatments __________________________________________________________________

	drop india_ee_prompt_DO
	drop india_ce_prompt
	drop india_ce_prompt
	drop us_ce_prompt
	drop us_ce_prompt_DO	
*/

encode india_ce_prompt, gen(sb_ce_wouldcoop)
	recode sb_ce_wouldcoop (1 = 1 "Would Accept")(2 = 0 "Would Reject"), gen(ce_wouldcoop)

encode fl_45_do, gen(treat)
	recode treat (1 = 0)(2 = 1)(3 = 2)(4 = 3)(5 = 4)
	lab def main_treat 0 "Control" 1 "PT" 2 "EE" 3 "Think" 4 "US"
	lab val treat main_treat
	
	
	gen treat_pt = 1 if treat == 1
		replace treat_pt = 0 if treat == 0
	
	
/* Outcomes ____________________________________________________________________*/


encode coop_support, gen(sb_dv_coop)
	recode sb_dv_coop 	(4 = 1 "Strongly oppose") ///
						(2 = 2 "Somewhat oppose") ///
						(1 = 3 "neither") ///
						(3 = 4 "somewhat support") ///
						(5 = 5 "strongly support"), ///
						gen(dv_coop)
						
gen dv_coop_dum = (dv_coop > 3)


/* Manipulation Checks __________________________________________________________*/


	encode india_support, gen(sb_india_support)			
		recode sb_india_support	 (2 = 1 "Believe India will accept") ///
								 (1 = 0 "Believe India will reject"), ///
								 gen(manip_india)								 

	gen manip_ee = .
	replace manip_ee = 1 if ee_check == "Strongly disagree"
	replace manip_ee = 2 if ee_check == "Somewhat disagree"
	replace manip_ee = 3 if ee_check == "Neither agree nor disagree"
	replace manip_ee = 4 if ee_check == "Somewhat agree"
	replace manip_ee = 5 if ee_check == "Strongly agree"
	
	lab val manip_ee fpcoop
	
	
	gen manip_ce = .
	replace manip_ce = 1 if ce_check == "Strongly disagree"
	replace manip_ce = 2 if ce_check == "Somewhat disagree"
	replace manip_ce = 3 if ce_check == "Neither agree nor disagree"
	replace manip_ce = 4 if ce_check == "Somewhat agree"
	replace manip_ce = 5 if ce_check == "Strongly agree"
	
	lab val manip_ce fpcoop
	
	rename ft_india_1 manip_thermo
	
	encode q84, gen(sb_attention)
		recode sb_attention (1 = 0 "Go with gut")(2 = 1 "Think things through"), ///
							gen(manip_attention)						

	lab drop dv_coop 

	lab drop c_ideology
	

/* Save __________________________________________________________*/

	keep c_age c_gender c_education c_pt_allsides c_pt_touched c_pt_tender c_pt_nopov c_pt_notsorry c_ce_index c_ee_index c_pt_index c_fpmil_milstrength c_fpmil_influence c_fpmil_milbad c_fpmil_index c_fpmil_index_med c_fpmil_extreme c_fpcoop_un c_fpcoop_multilateral c_fpcoop_active c_fpcoop_iso c_fpcoop_index c_fpcoop_index_extreme c_fpcoop_index_med c_fpcoop_extreme c_attention c_pid c_pid_long c_pid_strong ce_wouldcoop treat treat_pt dv_coop dv_coop_dum manip_india manip_ee manip_ce manip_attention wave manip_thermo u_id c_ideology check1_captcha check2_swim
	save "${stata}\ptinir_data_wave3_clean.dta", replace
